package com.huadi.controller;

import com.huadi.domain.Teacher;
import com.huadi.domain.Violation;
import com.huadi.service.TeacherService;
import com.huadi.service.ViolationService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

@Controller
@RequestMapping("/violation")
public class ViolationController {
    @Resource
    private ViolationService service;
    @RequestMapping("/addViolation.do")
    public ModelAndView addViolation(Violation violation){
        ModelAndView mv = new ModelAndView();
        String tips = "注册失败";
        int nums = service.addViolation(violation);
        if ( nums > 0){
            tips = "违规信息表【"+violation.getViolation_id()+"】注册成功";
        }

        mv.addObject("tips",tips);

        mv.setViewName("result");

        return mv;
    }

}
